package com.android.loveandhate.detector.marker;

import java.util.Map;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PointF;

public class HelpLines {
	private Canvas canvas;
	private float sizeEye, x, y;
	private Paint checkLine = new Paint(Paint.ANTI_ALIAS_FLAG);
    private Paint checkLine2 = new Paint(Paint.ANTI_ALIAS_FLAG);
	private Paint rect = new Paint(Paint.ANTI_ALIAS_FLAG);

	public HelpLines( Canvas canvasTmp, float distance, PointF middlePoint, float xRatio, float yRatio) {
		canvas = canvasTmp;
		
		x = (middlePoint.x*xRatio);
        y = (middlePoint.y*yRatio);
        sizeEye = distance/2;
        
		checkLine.setStyle(Paint.Style.STROKE);
        checkLine.setStrokeWidth(distance /36);
	}
	
	public void drawHeadRect() {
		checkLine.setColor(Color.RED);
		canvas.drawRect((float)(x-(sizeEye*2)), (float)(y-(sizeEye*3)), (float)(x+(sizeEye*2)), (float)(y+(sizeEye*3)), checkLine);
	}
	
	public void drawEyes() {
		drawLeftOuterEye();
		drawLeftInnerEye();
		drawRightInnerEye();
		drawRightOuterEye();
	}
	
	private void drawLeftOuterEye() {
		checkLine.setColor(Color.GREEN);
		canvas.drawLine((float)(x-(sizeEye*1.5)), (float)y-10, (float)(x-(sizeEye*1.5)), (float)y+10, checkLine);
	}
	
	private void drawLeftInnerEye() {
		checkLine.setColor(Color.GREEN);
		canvas.drawLine((float)(x-(sizeEye*0.5)), (float)y-10, (float)(x-(sizeEye*0.5)), (float)y+10, checkLine);
	}
	
	private void drawRightOuterEye() {
		checkLine.setColor(Color.GREEN);
		canvas.drawLine((float)(x+(sizeEye*1.5)), (float)y-10, (float)(x+(sizeEye*1.5)), (float)y+10, checkLine);
	}
	
	private void drawRightInnerEye() {
		checkLine.setColor(Color.GREEN);
		canvas.drawLine((float)(x+(sizeEye*0.5)), (float)y-10, (float)(x+(sizeEye*0.5)), (float)y+10, checkLine);
	}
	
	public void verticalSplit() {
		checkLine.setColor(Color.BLUE);
		canvas.drawLine( x, (float)(y-(sizeEye*3)), x, (float)(y+(sizeEye*3)), checkLine);
	}
	
	public void horizontalSpit() {
		checkLine.setColor(Color.MAGENTA);
		canvas.drawLine( x-sizeEye*2, (float)(y-(sizeEye)), x+sizeEye*2, (float)(y-(sizeEye)), checkLine);
        canvas.drawLine( x-sizeEye*2, (float)(y+(sizeEye)), x+sizeEye*2, (float)(y+(sizeEye)), checkLine);
	}
}
